package com.vegetable.modules.entity.finance.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * <p>
 * 逾期等级统计VO
 * </p>
 *
 * @author vegetable
 * @since 2025-10-25
 */
@Data
@ApiModel(value = "OverdueLevelStatisticsVO", description = "逾期等级统计VO")
public class OverdueLevelStatisticsVO implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "逾期等级：1-15天以内，2-15-29天，3-30-59天，4-60-89天，5-90天以上")
    private Integer overdueLevel;

    @ApiModelProperty(value = "逾期等级名称")
    private String overdueLevelName;

    @ApiModelProperty(value = "逾期天数范围描述")
    private String overdueDaysRange;

    @ApiModelProperty(value = "背景色")
    private String backgroundColor;

    @ApiModelProperty(value = "优先级")
    private String priority;

    @ApiModelProperty(value = "订单数量")
    private Integer orderCount;

    @ApiModelProperty(value = "未回款总金额")
    private BigDecimal totalUnreceivedAmount;

    @ApiModelProperty(value = "订单总金额")
    private BigDecimal totalOrderAmount;

    @ApiModelProperty(value = "已回款总金额")
    private BigDecimal totalReceivedAmount;

    @ApiModelProperty(value = "最大逾期天数")
    private Integer maxOverdueDays;

    @ApiModelProperty(value = "最小逾期天数")
    private Integer minOverdueDays;

    @ApiModelProperty(value = "平均逾期天数")
    private Integer avgOverdueDays;

    /**
     * 获取逾期等级名称
     */
    public String getOverdueLevelName() {
        if (overdueLevel == null) {
            return "";
        }
        switch (overdueLevel) {
            case 1:
                return "15天以内";
            case 2:
                return "15-29天";
            case 3:
                return "30-59天";
            case 4:
                return "60-89天";
            case 5:
                return "90天以上";
            default:
                return "未知";
        }
    }

    /**
     * 获取逾期天数范围描述
     */
    public String getOverdueDaysRange() {
        if (overdueLevel == null) {
            return "";
        }
        switch (overdueLevel) {
            case 1:
                return "0-14天";
            case 2:
                return "15-29天";
            case 3:
                return "30-59天";
            case 4:
                return "60-89天";
            case 5:
                return "90天以上";
            default:
                return "未知";
        }
    }

    /**
     * 获取背景色
     */
    public String getBackgroundColor() {
        if (overdueLevel == null) {
            return "";
        }
        switch (overdueLevel) {
            case 1:
                return "#FFFFFF";  // 默认白色
            case 2:
                return "#FFE4B5";  // 浅橙色
            case 3:
                return "#FFA500";  // 橙色
            case 4:
                return "#FF0000";  // 红色
            case 5:
                return "#8B0000";  // 深红色
            default:
                return "#FFFFFF";
        }
    }

    /**
     * 获取优先级
     */
    public String getPriority() {
        if (overdueLevel == null) {
            return "";
        }
        switch (overdueLevel) {
            case 1:
                return "低";
            case 2:
                return "普通";
            case 3:
                return "中";
            case 4:
                return "高";
            case 5:
                return "极高";
            default:
                return "未知";
        }
    }
}
